<template>
	<view>
		<view class="mainpadding2 ffffff">
			<u-tabs :list="tabs" lineColor="#1BA95B" :scrollable="false" @click="changetab" :activeStyle="{
				    color: '#1BA95B',
				    fontWeight: 'bold',
				    transform: 'scale(1.05)'
				}" :inactiveStyle="{
				            color: '#333333',
							fontWeight: '400',
				            transform: 'scale(1)'
				        }" itemStyle="padding-left: 5px; padding-right: 10px; height: 44px;"></u-tabs>
		</view>
		<!-- 内容 -->
		<view class="mainpadding2">
			<view class="flexcenter" v-if="!list.data.length">
				<view class="placeholderimage" style="margin-top: 300rpx;"></view>
			</view>
			<view class="mainpadding_top ffffff radius" v-for="item in list.data" :key="item.id">
				<view class="flexbetween xiahuaxian">
					<view class="titletext sanshier xiaohei fonweight">{{item.createtime_text}}</view>
					<view class="xiaolv strongtext" v-if="item.hx_status==1">未核销</view>
					<view class="xiaolv strongtext" v-if="item.hx_status==2">已核销</view>
					<view class="xiaohui strongtext" v-if="item.hx_status==3">已取消</view>
					<view class="xiaohuang strongtext" v-if="item.hx_status==4">取消审核中</view>
				</view>
				<view class="margin_top">
					<view class="flexbetween">
						<view class="shilitu margin_right2">
							<image :src="item.ss.image_text" mode=""></image>
						</view>
						<view class="flexcolumn"
							style="width: 69%;align-items: flex-start;height: 160rpx;justify-content: space-between;">
							<view class="titletext xiaohei fonweight yhxk">{{item.ss.name}}</view>
							<view class="strongtext xiaohui nofonweight">
								开始时间：{{item.ss.bs_starttime_text}}</view>
							<view class="strongtext xiaohui nofonweight">
								截至时间：{{item.ss.bs_endtime_text}}</view>
							<view class="sanshier xiaohong fonweight">￥{{item.ss.price}}</view>
						</view>
					</view>
				</view>
				<view class="margin_top">
					<view class="main_size xiaohui">{{item.username}}：{{item.mobile}}</view>
				</view>
				<view class="flexright margin_top" v-if="item.hx_status==4">
					<view class="lvbtn margin_left" @click="show=true;currentid=item.id">审核</view>
				</view>

			</view>
		</view>
		<u-modal :show="show" title="审批" confirmText="确认" @confirm="shenhe" cancelText="取消" @cancel="show=false"
			showCancelButton>
			<view class="slot-content" style="width: 600rpx;">
				<view class="flexbetween margin_top">
					<view class="main_size bold hei_text">审批：</view>
					<view class="flexright">
						<u-radio-group v-model="status" placement="row" circle>
							<u-radio activeColor="#1ba95b" label="确认取消" :customStyle="{marginRight: '30rpx'}"
								name="3"></u-radio>
							<u-radio activeColor="#1ba95b" label="拒绝取消" name="1"></u-radio>
						</u-radio-group>
					</view>

				</view>
			</view>
		</u-modal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				show: false,
				currentid: "",
				user_zbfapply_listid: "",
				status: "3"
			}
		},
		onLoad(options) {
			this.user_zbfapply_listid = options.user_zbfapply_listid
		},
		onShow() {
			this.init()
		},
		methods: {
			shenhe() {
				httpRequest.request("/api/sscl/sureCancelSsBm", 'GET', {
					id: this.currentid,
					hx_status: this.status
				}).then(res => {
					this.show = false
					httpRequest.toast(res.msg)
					if (res.code == 1) {
						this.init()
					}
				})
			},
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit,
					user_zbfapply_id: this.user_zbfapply_listid
				}
				let url = '/api/sscl/ssJgBmIndex'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #F9F9F9;
	}

	.shilitu {
		width: 200rpx;
		height: 160rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>